package yifeng.program;

/**
 * 递归的时候只需处理：1.递归出口	2.各节点handle itself，
 * 并且处理的过程要可以克隆到别的序号的节点
 * @author Administrator
 *
 */
public class ConDiGuiRuMen {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int[] a = new int[10001];
		a[1] = 1;
		a[2] = 1;
		System.out.println(new ConDiGuiRuMen().fibonacci(4000, a));
	}
	
	public int fibonacci(int i, int[] a) {
		if (a[i] != 0)
			return a[i];

		int value = fibonacci(i - 1, a) + fibonacci(i - 2, a);
		a[i] = value;
		return a[i];
	}

}
